﻿using HardcoreGame.Common.GlobalItems;
using Terraria.ID;
using Terraria.ModLoader;
namespace HardcoreGame.Common.Systems
{
    public class FoodSystem : ModSystem
    {
        /// <summary>
        /// SingleDecayRate是单个食物的腐烂速率
        /// StackedDecayRate是堆叠食物的腐烂速率
        /// SpoilageThreshold是食物腐烂的阈值
        /// </summary>
        public override void Load()
        {
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.CookedMarshmallow, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (12 * 86400f),
                StackedDecayRate = 0.5f / (12 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.CookedFish, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (3 * 86400f),
                StackedDecayRate = 0.5f / (3 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.CookedShrimp, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (3 * 86400f),
                StackedDecayRate = 0.5f / (3 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.GrilledSquirrel, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (2 * 86400f),
                StackedDecayRate = 0.5f / (2 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.RoastedBird, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (1.3f * 86400f),
                StackedDecayRate = 0.5f / (1.3f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.RoastedDuck, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (1.3f * 86400f),
                StackedDecayRate = 0.5f / (1.3f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.FriedEgg, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (1.5f * 86400f),
                StackedDecayRate = 0.5f / (1.5f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.BowlofSoup, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (1.3f * 86400f),
                StackedDecayRate = 0.5f / (1.3f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.BunnyStew, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (10 * 86400f),
                StackedDecayRate = 0.5f / (10 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.GrubSoup, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (1.3f * 86400f),
                StackedDecayRate = 0.5f / (1.3f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Pho, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / 86400f,
                StackedDecayRate = 0.5f / 86400f,
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Escargot, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (5 * 86400f),
                StackedDecayRate = 0.5f / (5 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.LobsterTail, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (2.5f * 86400f),
                StackedDecayRate = 0.5f / (2.5f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Sashimi, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (2.5f * 3600f),
                StackedDecayRate = 0.5f / (2.5f * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.SeafoodDinner, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.ShuckedOyster, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.ShrimpPoBoy, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.AppleJuice, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.BloodyMoscato, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (9 * 3600f),
                StackedDecayRate = 0.5f / (9 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.CreamSoda, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.FruitJuice, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.GrapeJuice, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.BananaDaiquiri, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.ChristmasPudding, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Eggnog, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.GingerbreadCookie, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (8 * 3600f),
                StackedDecayRate = 0.5f / (8 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.JojaCola, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(2266, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(353, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.JojaCola, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(5041, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (4 * 86400f),
                StackedDecayRate = 0.5f / (4 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.PeachSangria, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.PinaColada, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (24 * 86400f),
                StackedDecayRate = 0.5f / (24 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.PrismaticPunch, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.SmoothieofDarkness, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (4 * 3600f),
                StackedDecayRate = 0.5f / (4 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.TropicalSmoothie, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (4 * 3600f),
                StackedDecayRate = 0.5f / (4 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.BananaSplit, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (15 * 3600f),
                StackedDecayRate = 0.5f / (15 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.ChocolateChipCookie, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (5 * 86400f),
                StackedDecayRate = 0.5f / (5 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.FroggleBunwich, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (15 * 86400f),
                StackedDecayRate = 0.5f / (15 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.IceCream, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (2 * 3600f),
                StackedDecayRate = 0.5f / (2 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Marshmallow, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (12 * 86400f),
                StackedDecayRate = 0.5f / (12 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Milkshake, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (2 * 3600f),
                StackedDecayRate = 0.5f / (2 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.PotatoChips, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 86400f),
                StackedDecayRate = 0.5f / (48 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.PumpkinPie, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (3 * 86400f),
                StackedDecayRate = 0.5f / (3 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.SugarCookie, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (24 * 86400f),
                StackedDecayRate = 0.5f / (24 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.ApplePie, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (1.5f * 86400f),
                StackedDecayRate = 0.5f / (1.5f * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Bacon, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.BBQRibs, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Burger, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / 86400f,
                StackedDecayRate = 0.5f / 86400f,
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.ChickenNugget, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (30 * 3600f),
                StackedDecayRate = 0.5f / (30 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Fries, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / 86400f,
                StackedDecayRate = 0.5f / 86400f,
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Hotdog, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (3 * 86400f),
                StackedDecayRate = 0.5f / (3 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.MonsterLasagna, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Nachos, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.PadThai, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / 86400f,
                StackedDecayRate = 0.5f / 86400f,
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Pizza, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (4 * 3600f),
                StackedDecayRate = 0.5f / (4 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.SauteedFrogLegs, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Spaghetti, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (3 * 86400f),
                StackedDecayRate = 0.5f / (3 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.CoffeeCup, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / 86400f,
                StackedDecayRate = 0.5f / 86400f,
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.FruitSalad, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (9 * 3600f),
                StackedDecayRate = 0.5f / (9 * 3600f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.GoldenDelight, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (6 * 86400f),
                StackedDecayRate = 0.5f / (6 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(ItemID.Teacup, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (0.5f * 86400f),
                StackedDecayRate = 0.5f / (0.5f * 86400f),
                SpoilageThreshold = 100f
            });
            var fruits = new[] {
    ItemID.Starfruit, ItemID.Rambutan, 5278, ItemID.Plum, ItemID.Pineapple,
    ItemID.Peach, ItemID.Mango, ItemID.Lemon, ItemID.Grapefruit, ItemID.Elderberry,
    ItemID.Dragonfruit, ItemID.Coconut, ItemID.Cherry, ItemID.BloodOrange,
    ItemID.BlackCurrant, ItemID.Banana, ItemID.Apricot, ItemID.Apple, ItemID.Grapes
};
            foreach (var fruit in fruits)
            {
                IndependentFoodFreshnessSystem.RegisterFood(fruit, new FoodFreshnessInfo
                {
                    SingleDecayRate = 0.2f,
                    StackedDecayRate = 0.1f,
                    SpoilageThreshold = 30f
                });
            }
            IndependentFoodFreshnessSystem.RegisterFood(5277, new FoodFreshnessInfo
            {
                SingleDecayRate = 1f / (48 * 2 * 86400f),
                StackedDecayRate = 0.5f / (48 * 2 * 86400f),
                SpoilageThreshold = 100f
            });
            IndependentFoodFreshnessSystem.RegisterFood(4246, new FoodFreshnessInfo
            {
                SingleDecayRate = 0.2f,
                StackedDecayRate = 0.1f,
                SpoilageThreshold = 30f,
            });
            IndependentFoodFreshnessSystem.RegisterFood(4285, new FoodFreshnessInfo
            {
                SingleDecayRate = 0.2f,
                StackedDecayRate = 0.1f,
                SpoilageThreshold = 30f,
            });
        }
    }
}
